<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" type="text/css" href="resources/css/default.css" />
<title>Last ned</title>
</head>
<body>
	<header>
		<nav>
			<?php include("menu.php")?>
		</nav>
	</header>
	<div id=outercontainer>
		<div id=innercontainer>
			<?php
				//download.php
				$dir = './dokumenter/';
				
				
				if (isset($_GET['file']) && !is_dir($_GET['file']) && file_exists($dir . $_GET['file'])) 
				{ 
				    $file = $dir . $_GET['file']; 
				    header('Content-type: application/force-download'); 
				    header('Content-Transfer-Encoding: Binary'); 
				    header('Content-length: ' . filesize($file));
				    $filename = basename($file); 
				    header("Content-disposition: attachment; filename=\"$filename\""); 
				    readfile($file); 
				} 
				else 
				{ 
				    echo 'Ingen fil valgt';
				} 
			?>
			
		</div>
	</div>

	<footer><?php include("footer.php")?></footer>
</body>
</html>
